package com.shenmazong.task;

import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @author 军哥
 * @version 1.0
 * @description: TODO
 * @date 2022/4/3 20:51
 */

@Component
@Slf4j
public class TestTask {

    @Bean
    public XxlJobSpringExecutor xxlJobExecutor() {
        log.info(">>>>>>>>>>> xxl-job config init.");
        XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
        xxlJobSpringExecutor.setAdminAddresses("http://192.168.3.93:8080/xxl-job-admin");
        xxlJobSpringExecutor.setAppname("server-demo-xxljob");
        xxlJobSpringExecutor.setIp("192.168.3.93");
        xxlJobSpringExecutor.setPort(-1);
        xxlJobSpringExecutor.setAccessToken(null);
        xxlJobSpringExecutor.setLogPath(null);
        xxlJobSpringExecutor.setLogRetentionDays(-1);
        return xxlJobSpringExecutor;
    }

    @XxlJob("testHelloWorld")
    public void testHelloWorld() {
        System.out.println("testHelloWorldtestHelloWorld...");
    }
}
